/* QtLua -- Lua bindings for Qt
   Copyright (C) 2011, Jarek Pelczar

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 3 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General
   Public License along with this library; if not, write to the
   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301 USA

*/

#ifndef QLUAPROPERTY_H
#define QLUAPROPERTY_H

#include <QObject>
#include <QExplicitlySharedDataPointer>

class QLuaScriptEngine;
class QLuaScriptValue;
class QLuaPropertyData;

class QLuaProperty
{
public:
    enum PropertyTypeCategory { InvalidCategory, List, Object, Normal };
    enum Type { Invalid, Property, SignalProperty };

    QLuaProperty();
    QLuaProperty(QObject * obj);
    QLuaProperty(QObject * obj, QLuaScriptEngine * engine);
    QLuaProperty(QObject * obj, const QString& name);
    QLuaProperty(QObject * obj, const QString& name, QLuaScriptEngine * engine);
    QLuaProperty(const QLuaProperty& other);
    ~QLuaProperty();
    QLuaProperty& operator = (const QLuaProperty& other);

    bool connectNotifySignal ( QObject * dest, const char * slot ) const;
    bool connectNotifySignal ( QObject * dest, int method ) const;
    bool hasNotifySignal() const;
    int	index() const;
    bool isDesignable() const;
    bool isProperty() const;
    bool isResettable() const;
    bool isSignalProperty() const;
    bool isValid() const;
    bool isWritable() const;
    QMetaMethod	method() const;
    QString name() const;
    bool needsNotifySignal() const;
    QObject * object() const;
    QMetaProperty property() const;
    int	propertyType() const;
    PropertyTypeCategory propertyTypeCategory() const;
    const char * propertyTypeName() const;
    QVariant read() const;
    bool reset() const;
    Type type() const;
    bool write(const QVariant & value) const;
private:
    QExplicitlySharedDataPointer<QLuaPropertyData> data;
};

#endif // QLUAPROPERTY_H
